#include "comm.hpp"


int main()
{
    PipeInit init;

    //打开文件
    int fid = open(filename, O_RDONLY);
    if(fid < 0)
    {
        perror("open");
        exit(File_open_failed);
    }

    while(1)
    {
        //读
        char buffer[RDSIZE] = { 0 };
        int n = read(fid, buffer, RDSIZE);
        if(n <= 0)
            break;
        buffer[n] = '\0';
        std::cout << "客户说: " << buffer << std::endl;
    }

    //关闭文件
    int x = close(fid);
    if(x < 0)
    {
        perror("close");
        exit(File_close_failed);
    }

    return 0;
}


